import Vue from 'vue'
import Router from 'vue-router'
import single from '../../backend/html/article/index'  /*文章上传*/
import articleType from '../../backend/html/article/type'  /*文章类型*/
import photo from '../../backend/html/photo/index'   /*照片上传*/
import '../../../static/css/backend/article/index.css'
import photoType from  '../../backend/html/photo/type.vue'  //照片类别
import  addArticle from '../../backend/html/article/add.vue'
import login from '../../backend/html/login/login.vue'
import main from '../../backend/html/main/main.vue'
import photoControl from '../../backend/html/photo/control.vue'  //相册管理
import photoItem from '../../backend/html/photo/photoItem.vue' //相片
Vue.use(Router);
const router =  new Router({
  /*  mode:'history',*/
    routes: [
        {
            path:'/',
            name:'login',
            component: login,
            meta: {

            },
        },
        {
            path: '/main',
            name: 'main',
            component: main,
            meta: {
                requireAuth: true,
            },
            children:[
                {
                    path: '/add',
                    name: 'addArticle',
                    meta:{
                        requireAuth:true
                    },
                    component:  addArticle,
                },
                {
                    path: '/article',
                    name: 'article',
                    meta:{
                        requireAuth:true
                    },
                    component: single
                },
                {
                    path: '/articleType',
                    name: 'articleType',
                    meta:{
                        requireAuth:true
                    },
                    component: articleType
                },
                {
                    path: '/photo',
                    name: 'photo',
                    meta:{
                        requireAuth:true
                    },
                    component: photo
                },
                {
                    path: '/photoType',
                    name: 'photoType',
                    meta:{
                        requireAuth:true
                    },
                    component: photoType
                },
                {
                    path: '/photoItem',
                    name: 'phototItem',
                    component:  photoItem,
                },
                {
                    path: '/photoControl',
                    name: 'photoControl',
                    meta:{
                        requireAuth:true
                    },
                    component: photoControl,
                }
            ]
        },
        {
            path: '**',   // 错误路由[写在最后一个]
            redirect: '/backend.html'   //重定向
        }
    ]
})
export default router;
